<%= render :partial => "search_form", :locals => {:query => @query} %>
<div class="contentBox">
  <div class="resultsContainer">
    <%= render :partial => "search_results" %>
  </div>
  <div class="personalContainer">
    <script type="text/javascript">
      function toggleAccordion() {
        jQuery('#bookmark-header').toggleClass('active');
        jQuery('#bookmark-content').slideToggle('normal');
        jQuery('#history-header').toggleClass('active');
        jQuery('#history-content').slideToggle('normal');
      }
    </script>
    <h3 id="bookmark-header" onclick="toggleAccordion();" class="active"><span>Bookmarked:</span><%= image_tag('transparent.gif') %></h3>
    <ul id="bookmark-content" style="display: block;">
      <% if @bookmarked.length > 0 %>
        <% @bookmarked.each do |i| %>
          <li id="bookm-<%= i.id %>">
            <%= link_to_remote(image_tag('transparent.gif'), :update => "bookm-#{i.id}", :url => {:controller => 'search', :action => 'un_bookmark', :id => i.id}, :html => {:class => 'delete'}) %>
            <%= link_to_remote(i.title, :update => 'previewContainer', :url => {:controller => 'search', :action => 'preview_item', :id => i.id}, :after => 'togglePreview()') %>
          </li>
        <% end %>
      <% else %>
        <li>No bookmarks found</li>
      <% end %>
    </ul>
    <h3 id="history-header" onclick="toggleAccordion();"><span>History:</span><%= image_tag('transparent.gif') %></h3>
    <ul id="history-content" style="display: none;">
      <% if @history.length > 0 %>
        <% @history.each do |q| %>
          <li id="hist-<%= q.id %>">
            <%= link_to_remote(image_tag('transparent.gif'), :update => "hist-#{q.id}", :url => {:controller => 'search', :action => 'delete_history', :id => q.id}, :html => {:class => 'delete'}) %>
            <%= link_to(isolate_tokens(q.query), 'javascript:void(0);', :onclick => "$('q').value = '#{q.query}'; $('searchbox').onsubmit(); $('searchbox').submit();") %>
          </li>
        <% end %>
      <% else %>
        <li>No history found</li>
      <% end %>
    </ul>
  </div>
</div>